<html>
<head>
	<meta charset="utf-8"/>
	<link rel="stylesheet" href="/css/font-awesome.min.css" type="text/css">
	<link rel="stylesheet" href="/css/collection.css" type="text/css">
	<link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css">
	
	<script src="/js/view/jquery.min.js"></script>
	<script src="/js/view/bootstrap.min.js"></script>
	
	<title></title>
</head>
<body>
   <nav class="navbar navbar-default" role="navigation">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#drop_down">
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="#">我的收藏</a>
		</div>
		<div class="navbar-form navbar-left">
			    <input type="text" id="search" class="form-control" placeholder="搜索收藏内容" />
	    </div>
        <div class="navbar-right" style="line-height:50px;margin-left:30px;margin-right:20px;">
            <?= $username ?>
			<a href="/user/logout">注销<i class=" fa fa-sign-in"></i></a>
        </div>		
		<div class="collapse navbar-collapse">
		    <div class="navbar-right">
		    <label for="class_theme" style="font-family:'微软雅黑';">分类方式:</label>
			<select id="class_theme" onchange="showList()">
					<option value="1" onchange="showList()">按日期分类</option>
					<option value="2" onchange="showList()">按类型分类</option>
			</select>
            </div>
					
		</div>
			
	</nav>
	<div id="list" style="display:block">
	<?php foreach( $files as $file):?>
	    <div class="row states-info" style="margin-left:5px;">
		   <div class="col-md-2 column" >
		      <p>
				 <small><?= $file['createtime'] ?></small>
			  </p>
		   </div>
		   <div class="col-md-7 column">
					<p><?= $file['name'] ?><br/></p>  
		   </div>
		   <div class="col-md-3 column">
			<div id="showItem">
				<button type="button" class="btn btn-default btn-link">
					<a href="/file/view/id/<?=$file['id']?>">
						<i class="fa fa-search"></i>查看
					</a>
				</button>
				<button type="button" class="btn btn-link btn-default">
					<a href="/file/delete/id/<?=$file['id']?>">
						<i class="fa fa-trash"></i>删除
					</a>
				</button>
				<button type="button" class="btn btn-link btn-default">
					<a href="/file/update/id/<?=$file['id']?>">
						<i class="fa fa-paste"></i>修改
					</a>
				</button>
				<button type="button" class="btn btn-link btn-default">
					<a onclick="downLoad(<?= $file['id'] ?>)">
						<i class="fa fa-download"></i>下载
					</a>
				</button>
			</div>
		   </div>
		</div>
	<?php endforeach; ?>
	</div>
		
	<div id="listByType" style="display:none;">
		<div class="panel-group" id="accordion">
			<?php foreach( $types as $type):?>
				<div class="panel panel-default" >
					<div class="panel-heading">
						<h4 class="panel-title">
							 <a data-toggle="collapse" data-parent="#accordion" href= "#<?= $type['id'] ?>" >
								<?= $type['name']?>
							 </a>
						</h4>
					</div>
				</div>
				<div id="<?=$type['id']?>" class="panel-collapse collapse">
					<div class="panel-body">
						<?php foreach( $filesByType[$type['id']] as $typefile):?>
							<div class="row states-info">
							   <div class="col-md-2 column" >
								  <p>
									 <small><?= $typefile['createtime'] ?></small>
								  </p>
							   </div>
							   <div class="col-md-7 column">
										<p><?= $typefile['name'] ?><br/></p>  
							   </div>
							   <div class="col-md-3 column">
								<div id="showItem">
									<button type="button" class="btn btn-default btn-link">
										<a href="/file/view/id/<?=$typefile['id']?>">
											<i class="fa fa-search"></i>查看
										</a>
									</button>
									<button type="button" class="btn btn-link btn-default">
										<a href="/file/delete/id/<?=$typefile['id']?>">
											<i class="fa fa-trash"></i>删除
										</a>
									</button>
									<button type="button" class="btn btn-link btn-default">
										<a href="javascript:void(0);" onclick="downLoad(<?= $typefile['id'] ?>)">
											<i class="fa fa-download"></i>下载
										</a>
									</button>
								</div>
							   </div>
							</div>
						<?php endforeach; ?>
					</div>
				</div>
				
				
			<?php endforeach; ?>
		</div>
	</div>
	
</body>
<script src="/js/collect/collection.js"></script>
<script src="/js/collect/jspdf.debug.js"></script>
<script>
	window.open();
</script>
</html>